package cn.stylefeng.guns.modular.rest.pandian;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.core.util.DateUtil;
import cn.stylefeng.guns.modular.basic.entity.BasicArea;
import cn.stylefeng.guns.modular.basic.model.params.BasicAreaParam;
import cn.stylefeng.guns.modular.basic.model.params.BasicPositionParam;
import cn.stylefeng.guns.modular.basic.model.params.BasicWarehouseParam;
import cn.stylefeng.guns.modular.basic.model.result.BasicAreaResult;
import cn.stylefeng.guns.modular.basic.model.result.BasicPositionResult;
import cn.stylefeng.guns.modular.basic.model.result.BasicWarehouseResult;
import cn.stylefeng.guns.modular.basic.service.BasicAreaService;
import cn.stylefeng.guns.modular.basic.service.BasicPositionService;
import cn.stylefeng.guns.modular.basic.service.BasicWarehouseService;
import cn.stylefeng.guns.modular.pandian.entity.PandianChoupanDetailed;
import cn.stylefeng.guns.modular.pandian.model.params.PandianChoupanDetailedParam;
import cn.stylefeng.guns.modular.pandian.model.params.PandianChoupanParam;
import cn.stylefeng.guns.modular.pandian.model.result.PandianChoupanDetailedResult;
import cn.stylefeng.guns.modular.pandian.model.result.PandianChoupanResult;
import cn.stylefeng.guns.modular.pandian.service.PandianChoupanDetailedService;
import cn.stylefeng.guns.modular.pandian.service.PandianChoupanService;
import cn.stylefeng.guns.modular.rest.aop.UserAop;
import cn.stylefeng.guns.modular.rest.storage.children;
import cn.stylefeng.guns.modular.rest.storage.children2;
import cn.stylefeng.guns.modular.rest.storage.children3;
import cn.stylefeng.guns.modular.storage.entity.StorageStock;
import cn.stylefeng.guns.modular.storage.model.params.StorageStockParam;
import cn.stylefeng.guns.modular.storage.model.result.StorageStockResult;
import cn.stylefeng.guns.modular.storage.service.StorageStockService;
import cn.stylefeng.guns.modular.system.model.params.SysSwitchParam;
import cn.stylefeng.guns.modular.system.model.result.SysSwitchResult;
import cn.stylefeng.guns.modular.system.service.SysSwitchService;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.core.util.ToolUtil;

/**
 * 抽盘
 */
@Controller
@RequestMapping("/rest/ChouPan")
public class restChouPanController extends BaseController {

    @Autowired
    private PandianChoupanService pandianChoupanService;

    @Autowired
    private PandianChoupanDetailedService pandianChoupanDetailedService;

    @Autowired
    private StorageStockService storageStockService;
    
    @Autowired
    private UserAop userAop;

    @Autowired
    private BasicPositionService basicPositionService;

    @Autowired
    private BasicAreaService basicAreaService;

    /**
     * 查询商品总量，品类总量
     */
    @RequestMapping("/findByListGoodsType")
    @ResponseBody
    public ResponseData findByListGoodsType(StorageStockParam storageStockParam){
    	User user = userAop.getUser();
    	if(ToolUtil.isNotEmpty(storageStockParam.getPositionNumber())) {
    		BasicPositionParam basicPositionParam = new BasicPositionParam();
    		basicPositionParam.setPositionNumber(storageStockParam.getPositionNumber());
    		basicPositionParam.setDeliverId(user.getDeliverId());
    		BasicPositionResult basicPositionResult = basicPositionService.findBySpec(basicPositionParam, user.getDeptId(),user.getOperateId());
    		if(basicPositionResult == null) {
    			return ResponseData.error("库位不存在！");
    		} else {
    	        storageStockParam.setDeliverId(user.getDeliverId());
    	        storageStockParam.setDeptId(user.getDeptId());
    	        storageStockParam.setStockstate("在库");
    			storageStockParam.setPositionId(Long.parseLong(basicPositionResult.getId().toString()));
    		}
    	}
    	
        StorageStockResult ssr = storageStockService.findTotalBySpec(storageStockParam,user.getOperateId());
        //查询品类总量
        StorageStockResult ssr2 = storageStockService.findTotalgoodsTypeBySpec(storageStockParam,user.getOperateId());
        if (ssr2!=null&&ssr!=null) {
            if (!"0".equals(ssr2.getTotalgoodsType())) {
                ssr.setTotalgoodsType(ssr2.getTotalgoodsType());
            }
        }
        
        //查询库存商品列表
        if(ssr!=null) {
        	PandianChoupanParam moveDiskParam = new PandianChoupanParam();
            moveDiskParam.setDiskNumber(DateUtil.getDate());
            moveDiskParam.setDeliverId(user.getDeliverId());
            moveDiskParam.setDeptId(user.getDeptId());
            PandianChoupanResult moveDiskResult = pandianChoupanService.findBySpec(moveDiskParam,user.getOperateId());
            Long diskId = 0L;
            if(moveDiskResult != null) {
            	diskId = Long.parseLong(moveDiskResult.getId().toString());
            }
            storageStockParam.setPositionId(ssr.getPositionId());
            List<StorageStockResult> list1 = storageStockService.moveQueryGoods(storageStockParam,user.getOperateId());
            for (StorageStockResult r : list1) {
            	storageStockParam.setGoodsId(r.getGoodsId());
                List<StorageStockResult> list2 = storageStockService.moveDiskFindGoodsListChoupan(storageStockParam,diskId,user.getOperateId());
                r.setList2(list2);
    		}
            ssr.setList(list1);
        }
        return ResponseData.success(ssr);
    }
    
    @Autowired
	private SysSwitchService sysSwitchService;

    /**
     * 生成动盘单确定
     */
    @RequestMapping("/appsubmit")
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public ResponseData appsubmit(Long[] ids,String[] newbats, String[] truenums,Long goodsId,String pandianNodes) {
    	User user = userAop.getUser();
    	StorageStock storageStock00 = storageStockService.getById(ids[0]);
    	ResponseData data = new ResponseData();
    	PandianChoupanParam moveDiskParam = new PandianChoupanParam();
    	moveDiskParam.setWarehouseName(storageStock00.getWarehouseName());
    	moveDiskParam.setWarehouseId(storageStock00.getWarehouseId());
        moveDiskParam.setDiskNumber(DateUtil.getDate());
        moveDiskParam.setDeliverId(user.getDeliverId());
        moveDiskParam.setDeptId(user.getDeptId());
        Long DiskId = 0L;
        PandianChoupanResult moveDiskResult = pandianChoupanService.findBySpec(moveDiskParam,user.getOperateId());
        if (moveDiskResult == null){
            moveDiskParam.setDiskNumber(DateUtil.getDate());
            moveDiskParam.setCreateUserName(user.getName());
            pandianChoupanService.add(moveDiskParam);
            moveDiskResult = pandianChoupanService.findBySpec(moveDiskParam,user.getOperateId());
            DiskId = Long.valueOf(moveDiskResult.getId());
        } else {
            DiskId = Long.valueOf(moveDiskResult.getId());
        }
        List<PandianChoupanDetailedParam> stockParamList = new ArrayList<PandianChoupanDetailedParam>();
        for (int i = 0; i < ids.length; i++) {
        	PandianChoupanDetailedParam detailedParamnew = new PandianChoupanDetailedParam();
        	StorageStock storageStock = storageStockService.getById(ids[i]);
        	BasicArea basicArea = basicAreaService.getById(storageStock.getAreaId());
        	try {
            	detailedParamnew.setTrueNum(truenums[i]);
			} catch (Exception e) {
				ResponseData.error("请填写成数量");
			}
        	detailedParamnew.setNewgoodsbatchs(newbats[i]);
        	detailedParamnew.setWarehouseId(storageStock.getWarehouseId());
        	detailedParamnew.setGoodsId(goodsId);
        	detailedParamnew.setGoodsName(storageStock.getGoodsName());
        	detailedParamnew.setGoodsNumber(storageStock.getGoodsNumber());
        	detailedParamnew.setWarehouseName(storageStock.getWarehouseName());
        	detailedParamnew.setAreaId(storageStock.getAreaId());
        	detailedParamnew.setAreaName(basicArea.getAreaName());
        	detailedParamnew.setPositionId(storageStock.getPositionId());
        	detailedParamnew.setPositionNumber(storageStock.getPositionNumber());
        	detailedParamnew.setGoodsbatchs(storageStock.getGoodsbatchs());
        	detailedParamnew.setTrayNumber(storageStock.getTrayNumber());
        	detailedParamnew.setNum(storageStock.getNum());
        	detailedParamnew.setCreateUsername(user.getName());
        	detailedParamnew.setPandianNodes(pandianNodes);
        	stockParamList.add(detailedParamnew);
		}
        for (PandianChoupanDetailedParam s : stockParamList) {
        	if (ToolUtil.isEmpty(s.getTrueNum())) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚
                data.setMessage("请填写成数量");
        		data.setSuccess(false);
        		return data;
			}
        	BigDecimal as = new BigDecimal(0);
        	BigDecimal trueNum = new BigDecimal(s.getTrueNum());
        	BigDecimal num = new BigDecimal(s.getNum());
        	if (trueNum.compareTo(as)==-1) {
                data.setMessage("不能小于0");
        		data.setSuccess(false);
        		return data;
			}
        	
        	PandianChoupanDetailedParam param = new PandianChoupanDetailedParam();
            param.setDiskId(DiskId);
            param.setGoodsId(goodsId);
            param.setPositionNumber(s.getPositionNumber());
            param.setTrayNumber(s.getTrayNumber());
            param.setGoodsbatchs(s.getGoodsbatchs());
            PandianChoupanDetailedResult result = pandianChoupanDetailedService.findBySpec2(param);//查询已盘  待处理
            if (result!=null) {
            	if(num.compareTo(trueNum) != 0 || !s.getGoodsbatchs().equals(s.getNewgoodsbatchs())) {
                    //新增动盘单明细
                	if(trueNum.compareTo(as) == 0) {
                		result.setPanType("缺失");
                	} else if(trueNum.compareTo(num) == -1) {
                		result.setPanType("缺少");
                	} else if(trueNum.compareTo(num) == 1) {
                		result.setPanType("多出");
                	} else {
                		result.setPanType("修改批次");
                	}
            		SysSwitchParam dParam = new SysSwitchParam();
            		dParam.setDeliverId(user.getDeliverId());
            		dParam.setDeptId(user.getDeptId());
            		dParam.setCode("correct_switch");
            		SysSwitchResult dResult = sysSwitchService.findBySpec(dParam,user.getOperateId());
            		if (dResult!=null) {
            			if (ToolUtil.isNotEmpty(dResult.getOperation())) {
            				if ("Y".equals(dResult.getOperation())) {
            					result.setInventory("待处理");
            				} else {
            					result.setInventory("已盘");
            				}
            			}
            		}
            	} else {
            		result.setPanType("正常");
            		result.setInventory("已盘");
            	}
            	result.setNum(s.getNum());
            	result.setTrueNum(s.getTrueNum());
            	result.setGoodsbatchs(s.getGoodsbatchs());
            	result.setNewgoodsbatchs(s.getNewgoodsbatchs());
            	PandianChoupanDetailedParam ddp = new PandianChoupanDetailedParam();
                ToolUtil.copyProperties(result, ddp);
                pandianChoupanDetailedService.update(ddp);
			} else {
	            //新增动盘单明细
            	if(num.compareTo(trueNum) != 0 || !s.getGoodsbatchs().equals(s.getNewgoodsbatchs())) {
                    //新增动盘单明细
                	if(trueNum.compareTo(as) == 0) {
                		s.setPanType("缺失");
                	} else if(trueNum.compareTo(num) == -1) {
                		s.setPanType("缺少");
                	} else if(trueNum.compareTo(num) == 1) {
                		s.setPanType("多出");
                	} else {
                		s.setPanType("修改批次");
                	}
            		SysSwitchParam dParam = new SysSwitchParam();
            		dParam.setDeliverId(user.getDeliverId());
            		dParam.setDeptId(user.getDeptId());
            		dParam.setCode("correct_switch");
            		SysSwitchResult dResult = sysSwitchService.findBySpec(dParam,user.getOperateId());
            		if (dResult!=null) {
            			if (ToolUtil.isNotEmpty(dResult.getOperation())) {
            				if ("Y".equals(dResult.getOperation())) {
            					s.setInventory("待处理");
            				} else {
            					s.setInventory("已盘");
            				}
            			}
            		}
            	} else {
            		s.setPanType("正常");
            		s.setInventory("已盘");
            	}
                s.setDiskId(DiskId);
                s.setDiskNumber(moveDiskResult.getDiskNumber());
                s.setDeliverId(user.getDeliverId());
                pandianChoupanDetailedService.add(s);
			}
		}
        return ResponseData.success();
    }

    /**
     * 新增
     */
    @RequestMapping("/addStorage")
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public ResponseData addStorage(PandianChoupanDetailedParam pandianChoupanDetailedParam) {
    	User user = userAop.getUser();
    	ResponseData data = new ResponseData();
    	PandianChoupanParam moveDiskParam = new PandianChoupanParam();
    	moveDiskParam.setWarehouseId(pandianChoupanDetailedParam.getWarehouseId());
    	moveDiskParam.setWarehouseName(pandianChoupanDetailedParam.getWarehouseName());
        moveDiskParam.setDeliverId(user.getDeliverId());
        moveDiskParam.setDeptId(user.getDeptId());
        moveDiskParam.setDiskNumber(DateUtil.getDate());
        Long DiskId = 0L;
        PandianChoupanResult moveDiskResult = pandianChoupanService.findBySpec(moveDiskParam,user.getOperateId());
        if (moveDiskResult == null){
            moveDiskParam.setDiskNumber(DateUtil.getDate());
            moveDiskParam.setCreateUserName(user.getName());
            pandianChoupanService.add(moveDiskParam);
            moveDiskResult = pandianChoupanService.findBySpec(moveDiskParam,user.getOperateId());
            DiskId = Long.valueOf(moveDiskResult.getId());
        } else {
            DiskId = Long.valueOf(moveDiskResult.getId());
        }
        
    	if (ToolUtil.isEmpty(pandianChoupanDetailedParam.getTrueNum())) {
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚
            data.setMessage("请填写成数量");
    		data.setSuccess(false);
    		return data;
		}
    	BigDecimal as = new BigDecimal(0);
    	BigDecimal trueNum = new BigDecimal(pandianChoupanDetailedParam.getTrueNum());
    	if (trueNum.compareTo(as)==-1) {
            data.setMessage("不能小于0");
    		data.setSuccess(false);
    		return data;
		}
    	
        //新增动盘单明细
    	pandianChoupanDetailedParam.setNum("0");
    	pandianChoupanDetailedParam.setPanType("新增");
		SysSwitchParam dParam = new SysSwitchParam();
		dParam.setDeliverId(user.getDeliverId());
		dParam.setDeptId(user.getDeptId());
		dParam.setCode("correct_switch");
		SysSwitchResult dResult = sysSwitchService.findBySpec(dParam,user.getOperateId());
		if (dResult!=null) {
			if (ToolUtil.isNotEmpty(dResult.getOperation())) {
				if ("Y".equals(dResult.getOperation())) {
					pandianChoupanDetailedParam.setInventory("待处理");
				} else {
					pandianChoupanDetailedParam.setInventory("已盘");
				}
			}
		}
    	pandianChoupanDetailedParam.setDiskId(DiskId);
    	pandianChoupanDetailedParam.setDiskNumber(moveDiskResult.getDiskNumber());
    	pandianChoupanDetailedParam.setDeliverId(user.getDeliverId());
    	pandianChoupanDetailedParam.setCreateUsername(user.getName());
        pandianChoupanDetailedService.add(pandianChoupanDetailedParam);
        return ResponseData.success();
    }

    /**
     * 根据商品id查询商品
     */
    @RequestMapping("/findByGoods")
    @ResponseBody
    public ResponseData findByGoods(StorageStockParam stockParam){
    	User user = userAop.getUser();
        stockParam.setDeliverId(user.getDeliverId());
        stockParam.setDeptId(user.getDeptId());
        stockParam.setStockstate("在库");

        StorageStockResult ssr2 = storageStockService.findByGoods(stockParam,user.getOperateId());
        if(ssr2 != null) {
            List<StorageStockResult> list1 = storageStockService.totalGoodsVolumeList(stockParam,user.getOperateId());
        	PandianChoupanParam moveDiskParam = new PandianChoupanParam();
            moveDiskParam.setDiskNumber(DateUtil.getDate());
            moveDiskParam.setDeliverId(user.getDeliverId());
            moveDiskParam.setDeptId(user.getDeptId());
            PandianChoupanResult moveDiskResult = pandianChoupanService.findBySpec(moveDiskParam,user.getOperateId());
            Long diskId = 0L;
            if(moveDiskResult != null) {
            	diskId = Long.parseLong(moveDiskResult.getId().toString());
            }
            List<StorageStockResult> list12 = new ArrayList<StorageStockResult>();
            for (StorageStockResult r : list1) {
            	stockParam.setPositionId(r.getPositionId());
        		List<StorageStockResult> list2 = storageStockService.moveDiskFindGoodsListChoupan(stockParam, diskId,user.getOperateId());
        		r.setList2(list2);
        		list12.add(r);
    		}
            ssr2.setList(list12);
        }
        return ResponseData.success(ssr2);
    }

    @Autowired
    private BasicWarehouseService basicWarehouseService;

    /**
     * 查询仓库-库区-库位   三级联动
     */
    @ResponseBody
    @RequestMapping("/getWarehouselist")
    public ResponseData getWarehouselist() {
    	User user = userAop.getUser();
    	Long deliverId = user.getDeliverId();
    	Long deptId = user.getDeptId();
    	BasicWarehouseParam basicWarehouseParam = new BasicWarehouseParam();
    	basicWarehouseParam.setDeliverId(deliverId);
    	List<BasicWarehouseResult> wlist = this.basicWarehouseService.findListBySpec(basicWarehouseParam,deptId,user.getOperateId());
    	List<children> list = new ArrayList<children>();
    	for (BasicWarehouseResult w : wlist) {
    		BasicAreaParam basicAreaParam = new BasicAreaParam();
        	basicAreaParam.setDeliverId(deliverId);
        	basicAreaParam.setAreaWarehouseId(w.getId());
        	List<BasicAreaResult> alist = this.basicAreaService.findListBySpec(basicAreaParam,deptId,user.getOperateId());
        	List<children2> list2 = new ArrayList<children2>();
        	for (BasicAreaResult a : alist) {
        		BasicPositionParam basicPositionParam = new BasicPositionParam();
            	basicPositionParam.setDeliverId(deliverId);
            	basicPositionParam.setPositionAreaId(a.getId());
            	List<BasicPositionResult> plist = this.basicPositionService.ChouPanFindListBySpec(basicPositionParam,deptId,user.getOperateId());
            	List<children3> list3 = new ArrayList<children3>();
            	for (BasicPositionResult p : plist) {
                	children3 children3 = new children3();
                	children3.setValue(p.getId());
                	children3.setLabel(p.getPositionNumber());
                	list3.add(children3);
				}
            	children2 children2 = new children2();
            	children2.setChildren(list3);
            	children2.setValue(a.getId());
            	children2.setLabel(a.getAreaName());
            	list2.add(children2);
			}
        	children children = new children();
        	children.setChildren(list2);
        	children.setValue(w.getId());
        	children.setLabel(w.getWarehouseName());
        	list.add(children);
		}
        return ResponseData.success(list);
    }

    /**
     * 查询动盘单时间排序
     */
    @RequestMapping("/apphistorydetailedList")
    @ResponseBody
    public LayuiPageInfo apphistorydetailedList(PandianChoupanParam moveDiskParam,String condition){
    	User user = userAop.getUser();
        moveDiskParam.setDeliverId(user.getDeliverId());
        moveDiskParam.setDeptId(user.getDeptId());
        LayuiPageInfo layuiPageInfo = pandianChoupanService.findPageBySpec(moveDiskParam,condition,user.getOperateId());
        layuiPageInfo.setCode(200);
        return layuiPageInfo;
    }

    /**
     * 动盘单明细-2
     * @return
     */
    @RequestMapping("/findByGoodsList")
    @ResponseBody
    public ResponseData findByGoodsList(PandianChoupanDetailedParam moveDiskDetailedParam){
        List<PandianChoupanDetailedResult> list = pandianChoupanDetailedService.historyDetailedList(moveDiskDetailedParam);
        for (PandianChoupanDetailedResult r : list) {
        	moveDiskDetailedParam.setPositionId(r.getPositionId());
            List<PandianChoupanDetailedResult> list2 = pandianChoupanDetailedService.findPositionList(moveDiskDetailedParam);
            for (PandianChoupanDetailedResult rr: list2) {
            	PandianChoupanDetailedParam pandianChoupanDetailedParam = new PandianChoupanDetailedParam();
            	pandianChoupanDetailedParam.setDiskId(moveDiskDetailedParam.getDiskId());
            	pandianChoupanDetailedParam.setPositionId(rr.getPositionId());
            	pandianChoupanDetailedParam.setGoodsId(rr.getGoodsId());
            	List<PandianChoupanDetailedResult> list3 = pandianChoupanDetailedService.findListBySpec(pandianChoupanDetailedParam);
            	rr.setList(list3);
			}
            r.setList(list2);
		}
        return ResponseData.success(list);
    }

    /**
     * 异常库存处理:已处理页面
     */
    @RequestMapping("/appDeletelist")
    @ResponseBody
    public LayuiPageInfo appDeletelist(PandianChoupanDetailedParam moveDiskDetailedParam, String condition){
    	User user = userAop.getUser();
    	moveDiskDetailedParam.setDeliverId(user.getDeliverId());
    	LayuiPageInfo LayuiPageInfo = pandianChoupanDetailedService.deleteList(moveDiskDetailedParam, condition,user.getDeptId(),user.getOperateId());
    	LayuiPageInfo.setCode(200);
        return LayuiPageInfo;
    }
    
    /**
     * 异常库存处理：待处理
     */
    @RequestMapping("/appabnormalliststaylist")
    @ResponseBody
    public ResponseData appabnormalliststaylist(PandianChoupanDetailedParam param){
    	User user = userAop.getUser();
        param.setDeliverId(user.getDeliverId());
        param.setInventory("待处理");
        return ResponseData.success(pandianChoupanDetailedService.appabnormalliststaylist(param,user.getDeptId(),user.getOperateId()));
    }

    /**
     *点击处理按钮
     * @param dealList
     * @return
     */
    @RequestMapping("/deleteList")
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public ResponseData deleteList(PandianChoupanDetailedParam moveDiskDetailedParam) {
    	User user = userAop.getUser();
    	ResponseData data = new ResponseData();
    	PandianChoupanDetailed moveDiskDetailed = pandianChoupanDetailedService.getById(moveDiskDetailedParam.getId());
    	if (moveDiskDetailed ==null || "已处理".equals(moveDiskDetailed.getInventory())) {
        	data.setSuccess(false);
        	data.setMessage("已被其它人员处理");
        	return data;
		}
    	moveDiskDetailed.setNodes(moveDiskDetailedParam.getNodes());
    	moveDiskDetailed.setInventory("已处理");
    	moveDiskDetailed.setDealPerson(user.getName());//盘点处理人
        moveDiskDetailed.setDealTime(DateUtil.getDateS());//盘点处理时间
        PandianChoupanDetailedParam ddp = new PandianChoupanDetailedParam();
        ToolUtil.copyProperties(moveDiskDetailed, ddp);
        pandianChoupanDetailedService.update(ddp);
        boolean flag = storageStockService.correctNewChouPan(ddp,user);//修改库存
        if (!flag) {
        	pandianChoupanDetailedService.delete(ddp);
        	return ResponseData.error("库存发生变动，请重新操作");
		} else {
	        return ResponseData.success("处理完成");
		}
    }
    
    /**
     * 查询商品位置
     */
    @RequestMapping("/kucunlist")
    @ResponseBody
    public ResponseData kucunlist(StorageStockParam param){
    	User user = userAop.getUser();
    	param.setDeptId(user.getDeptId());
    	param.setDeliverId(user.getDeliverId());
        return ResponseData.success(storageStockService.findListBySpec(param,user.getOperateId()));
    }


}
